+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
+Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
+ from argv.
+
+Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/genmarshal.pl: Modified to be more idiomatic Perl,
+ to be more readable perl, to spit out stuff that looks
+ more like readable C, and to pipe output through indent
+ so output looks a lot like readable C. No functional
+ changes.
+
+Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
+ necessary when switching to a masked pixmap. (Based on a patch
+ from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
+
+Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkeditable.[ch]: Added action signals for keyboard
+ bindings. (move_cursor, kill_word, etc, etc, etc).
+
+ removed the time argument from
+ gtk_editable_cut/copy/paste_clipboard (source but not
+ binary incompatible...) Instead get time from
+ gtk_get_current_event ().
+
+ * gtk/gtktext.c gtk/gtkentry.c: Support the new editable
+ signals.
+
+Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
+
+ Patches from Damon Chaplin <DAChaplin@email.msn.com>:
+
+ gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
+ parent class to GtkNotebookClass when splitting the widget in
+ two. Also updated some comments.
+
+ gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
+ button without a font selected.
+
+ Fixed bug in set_font_name - I hadn't updated the code to
+ search for the style in the font_style clist - it was
+ still assuming the style row was equal to its index,
+ but it isn't any more.
+
+ Changed 'Reset' button on filter page to 'Clear Filter'.
+ Deleted old code relating to the old 'Filter Fonts' toggle
+ Updated some comments.
+ Cleared 'Actual Fontname' if no font is set.
+
+ gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
+ destroying the GtkFontSelection instead of the
+ GtkFontSelectionDialog.
+
+Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
+ flag to make all warnings fatal errors.
+
+ * gtk/testthreads.c: moved <pthreads.h> include inside
+ #ifdef USE_PTHREADS
+
+Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
+ gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
+
+ - Added new function gtk_container_set_resize_mode() for
+ fine-grained control of where resize-queueing is done.
+
+ - Removed GtkContainer::need_resize and GtkWindow::move_resize
+ - Added GtkContainer::check_resize to replace need_resize.
+
+ - Added function gtk_container_check_resize() to trigger
+ queued resizes, and gtk_container_resize_children() to
+ Figure which children need to be size-allocated. (logic
+ moved from gtkwindow.c)
+
+ - Reorganized code in gtkwindow.c
+
+ - Set the resize-mode for viewports so that resizes within
+ a viewport don't propagate out of it.
+
+
1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings.
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
- * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
+ * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font
lists from the klass structure to a static structure
in gtkfontsel.c; cleans up global the namespace.
-#!/usr/bin/perl
+#!/usr/bin/perl -w
#
# by Elliot Lee <sopwith@redhat.com>
"C_CALLBACK"=>"gpointer");
open(IL, "<".$ENV{'srcdir'}."/gtkmarshal.list") || die("Open failed: $!");
-open(OH, ">gtkmarshal.h") || die("Open failed: $!");
-open(OS, ">gtkmarshal.c") || die("Open failed: $!");
+open(OH, "|indent > gtkmarshal.h") || die("Open failed: $!");
+open(OS, "|indent > gtkmarshal.c") || die("Open failed: $!");
-print OH "#ifndef __GTKMARSHAL_H__\n#define __GTKMARSHAL_H__ 1\n\n";
-print OH "#include \"gtktypeutils.h\"\n#include \"gtkobject.h\"\n";
+print OH <<EOT;
+#ifndef __GTKMARSHAL_H__
+#define __GTKMARSHAL_H__ 1
-print OS "#include \"gtkmarshal.h\"\n";
+#include "gtktypeutils.h"
+#include "gtkobject.h"
+
+EOT
+
+print OS qq(#include "gtkmarshal.h"\n\n);
while(chomp($aline = <IL>)) {
($retval, $paramlist) = split(/:/, $aline, 2);
@params = split(/\s*,\s*/, $paramlist);
- if($defs{$retval."__".join("_",@params)} == 1) { next; }
+ my $funcname = $retval."__".join("_",@params);
+
+ next if (exists $defs{$funcname});
$doequiv = 0;
- foreach(@params) { if($trans{$_} eq "gpointer") { $doequiv = 1; } }
+ for (@params, $retval) {
+ if ($trans{$_} eq "gpointer") {
+ $doequiv = 1;
+ last;
+ }
+ }
+ # Translate all function pointers to gpointer
$defname = "";
if($doequiv) {
- $defname = $retval."__".join("_",@params);
- print OH "#define gtk_marshal_".$retval."__".join("_",@params)." ";
-
- for($i = 0; $i < scalar @params; $i++)
- { if($trans{$params[$i]} eq "gpointer") { $params[$i] = "POINTER"; } }
- if($trans{$retval} eq "gpointer") { $retval = "POINTER"; }
- print OH "gtk_marshal_".$retval."__".join("_",@params)."\n";
-
- $regname = $retval."__".join("_",@params);
- if($defs{$regname} == 1) { next; }
- $defs{$defname} = 1;
+ print OH "#define gtk_marshal_$funcname ";
+ $defs{$defname} = 1;
+
+ for (@params, $retval) {
+ if ($trans{$_} eq "gpointer") {
+ $_ = "POINTER";
+ }
+ }
+
+ $funcname = $retval."__".join("_",@params);
+
+ print OH "gtk_marshal_$funcname\n";
+ next if (exists $defs{$funcname});
}
+ $defs{$funcname} = 1;
- $defs{$retval."__".join("_",@params)} = 1;
-
- print OH "void gtk_marshal_".$retval."__".join("_",@params)."(GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args);\n";
-
- print OS "typedef ".$trans{$retval}. " (*GtkSignal_"
- .$retval."__".join("_",@params).")(GtkObject *object, ";
+ print OH <<EOT;
+void gtk_marshal_$funcname (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+EOT
+
+ print OS "typedef $trans{$retval} (*GtkSignal_$funcname) (GtkObject *object, \n";
$argn = 1;
- foreach $it(@params) { if($it ne "NONE") {print OS $trans{$it}." arg".$argn++.",\n"; } }
+ for (@params) {
+ print OS "$trans{$_} arg".$argn++.",\n" unless $_ eq "NONE";
+ }
print OS "gpointer user_data);\n";
- print OS "void gtk_marshal_".$retval."__".join("_",@params)."(GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args)\n";
+ print OS <<EOT;
+void gtk_marshal_$funcname (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args)
+{
+ GtkSignal_$funcname rfunc;
+EOT
- print OS "{\nGtkSignal_".$retval."__".join("_",@params)." rfunc;\n";
if($retval ne "NONE") {
- print OS $trans{$retval}." *return_val;\n";
-
- print OS "return_val = GTK_RETLOC_".$retval."(args[".(scalar @params)."]);\n";
+ print OS " $trans{$retval} *return_val;\n";
+ print OS " return_val = GTK_RETLOC_$retval (args[".(scalar @params)."]);\n";
}
- print OS "rfunc = (GtkSignal_".$retval."__".join("_",@params).") func;\n";
+ print OS " rfunc = (GtkSignal_$funcname) func;\n";
+ print OS " *return_val = " unless $retval eq "NONE";
+ print OS " (* rfunc) (object,\n";
- if($retval ne "NONE") { print OS "*return_val = "; }
-
- print OS "(* rfunc)(object, ";
for($i = 0; $i < (scalar @params); $i++) {
- ($params[$i] eq "NONE") && next;
- print OS "GTK_VALUE_".$params[$i]."(args[$i]), ";
+ if ($params[$i] ne "NONE") {
+ print OS " GTK_VALUE_$params[$i](args[$i]),\n";
+ }
}
- print OS "func_data);\n}\n\n";
+ print OS " func_data);\n}\n\n";
}
print OH "#endif\n";
+
close(IL); close(OH); close(OS);
;; generated by makeenums.pl ; -*- scheme -*-
-; enumerations from "./gtkclist.h"
+; enumerations from "../../gtk+/gtk/gtkclist.h"
(define-enum GtkCellType
(empty GTK_CELL_EMPTY)
(pixtext GTK_CELL_PIXTEXT)
(widget GTK_CELL_WIDGET))
-; enumerations from "./gtkctree.h"
+; enumerations from "../../gtk+/gtk/gtkctree.h"
(define-enum GtkCTreePos
(before GTK_CTREE_POS_BEFORE)
(dotted GTK_CTREE_LINES_DOTTED)
(none GTK_CTREE_LINES_NONE))
-; enumerations from "./gtkdebug.h"
+; enumerations from "../../gtk+/gtk/gtkdebug.h"
(define-flags GtkDebugFlag
(objects GTK_DEBUG_OBJECTS)
(misc GTK_DEBUG_MISC)
(signals GTK_DEBUG_SIGNALS))
-; enumerations from "./gtkenums.h"
+; enumerations from "../../gtk+/gtk/gtkenums.h"
(define-flags GtkAccelFlags
(visible GTK_ACCEL_VISIBLE)
(normal GTK_RELIEF_NORMAL)
(none GTK_RELIEF_NONE))
+(define-enum GtkResizeMode
+ (parent GTK_RESIZE_PARENT)
+ (queue GTK_RESIZE_QUEUE)
+ (immediate GTK_RESIZE_IMMEDIATE))
+
(define-flags GtkSignalRunType
(first GTK_RUN_FIRST)
(last GTK_RUN_LAST)
(dialog GTK_WINDOW_DIALOG)
(popup GTK_WINDOW_POPUP))
-; enumerations from "./gtkfontsel.h"
+; enumerations from "../../gtk+/gtk/gtkfontsel.h"
(define-enum GtkFontMetricType
(ixels-metric PIXELS_METRIC)
(oints-metric POINTS_METRIC))
-; enumerations from "./gtkobject.h"
+; enumerations from "../../gtk+/gtk/gtkobject.h"
(define-flags GtkObjectFlags
(destroyed GTK_DESTROYED)
(mask GTK_ARG_MASK)
(readwrite GTK_ARG_READWRITE))
-; enumerations from "./gtkpacker.h"
+; enumerations from "../../gtk+/gtk/gtkpacker.h"
(define-flags GtkPackerOptions
(expand GTK_PACK_EXPAND)
(w GTK_ANCHOR_W)
(e GTK_ANCHOR_E))
-; enumerations from "./gtkprivate.h"
+; enumerations from "../../gtk+/gtk/gtkprivate.h"
(define-flags GtkPrivateFlags
(user-style PRIVATE_GTK_USER_STYLE)
(has-shape-mask PRIVATE_GTK_HAS_SHAPE_MASK)
(in-reparent PRIVATE_GTK_IN_REPARENT))
-; enumerations from "./gtkspinbutton.h"
+; enumerations from "../../gtk+/gtk/gtkspinbutton.h"
(define-enum GtkSpinButtonUpdatePolicy
(always GTK_UPDATE_ALWAYS)
(if-valid GTK_UPDATE_IF_VALID))
-; enumerations from "./gtktoolbar.h"
+; enumerations from "../../gtk+/gtk/gtktoolbar.h"
(define-enum GtkToolbarChildType
(space GTK_TOOLBAR_CHILD_SPACE)
(radiobutton GTK_TOOLBAR_CHILD_RADIOBUTTON)
(widget GTK_TOOLBAR_CHILD_WIDGET))
-; enumerations from "./gtktree.h"
+; enumerations from "../../gtk+/gtk/gtktree.h"
(define-enum GtkTreeViewMode
(line GTK_TREE_VIEW_LINE)
(item GTK_TREE_VIEW_ITEM))
-; enumerations from "./gtktypeutils.h"
+; enumerations from "../../gtk+/gtk/gtktypeutils.h"
(define-enum GtkFundamentalType
(invalid GTK_TYPE_INVALID)
(c-callback GTK_TYPE_C_CALLBACK)
(object GTK_TYPE_OBJECT))
-; enumerations from "./gtkwidget.h"
+; enumerations from "../../gtk+/gtk/gtkwidget.h"
(define-flags GtkWidgetFlags
(toplevel GTK_TOPLEVEL)
(rc-style GTK_RC_STYLE)
(basic GTK_BASIC))
-; enumerations from "../gdk/gdkprivate.h"
+; enumerations from "../../gtk+/gdk/gdkprivate.h"
(define-flags GdkDebugFlag
(misc GDK_DEBUG_MISC)
(color-context GDK_DEBUG_COLOR_CONTEXT)
(xim GDK_DEBUG_XIM))
-; enumerations from "../gdk/gdktypes.h"
+; enumerations from "../../gtk+/gdk/gdktypes.h"
(define-enum GdkWindowType
(root GDK_WINDOW_ROOT)
switch (arg_id)
{
case ARG_LABEL:
- gtk_container_disable_resize (GTK_CONTAINER (button));
-
if (button->child)
{
gtk_widget_unparent (button->child);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (button), label);
- gtk_container_enable_resize (GTK_CONTAINER (button));
break;
default:
break;
enum {
ADD,
REMOVE,
- NEED_RESIZE,
+ CHECK_RESIZE,
FOREACH,
FOCUS,
SET_FOCUS_CHILD,
enum {
ARG_0,
ARG_BORDER_WIDTH,
- ARG_AUTO_RESIZE,
- ARG_BLOCK_RESIZE,
ARG_CHILD
};
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
-static void gtk_container_marshal_signal_4 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
static void gtk_container_class_init (GtkContainerClass *klass);
GtkWidget *widget);
static void gtk_container_remove_unimplemented (GtkContainer *container,
GtkWidget *widget);
-static gint gtk_container_real_need_resize (GtkContainer *container);
+static void gtk_container_real_check_resize (GtkContainer *container);
static gint gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction);
static void gtk_container_real_set_focus_child (GtkContainer *container,
hadjustment_key_id = gtk_object_data_force_id (hadjustment_key);
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
- gtk_object_add_arg_type ("GtkContainer::auto_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_RESIZE);
- gtk_object_add_arg_type ("GtkContainer::block_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_BLOCK_RESIZE);
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD);
container_signals[ADD] =
gtk_container_marshal_signal_1,
GTK_TYPE_NONE, 1,
GTK_TYPE_WIDGET);
- container_signals[NEED_RESIZE] =
- gtk_signal_new ("need_resize",
+ container_signals[CHECK_RESIZE] =
+ gtk_signal_new ("check_resize",
GTK_RUN_LAST,
object_class->type,
- GTK_SIGNAL_OFFSET (GtkContainerClass, need_resize),
- gtk_container_marshal_signal_4,
- GTK_TYPE_BOOL, 0);
+ GTK_SIGNAL_OFFSET (GtkContainerClass, check_resize),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
container_signals[FOREACH] =
gtk_signal_new ("foreach",
GTK_RUN_FIRST,
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
- class->need_resize = gtk_container_real_need_resize;
+ class->check_resize = gtk_container_real_check_resize;
class->foreach = NULL;
class->focus = gtk_container_real_focus;
class->set_focus_child = gtk_container_real_set_focus_child;
{
container->focus_child = NULL;
container->border_width = 0;
- container->auto_resize = TRUE;
container->need_resize = FALSE;
- container->block_resize = FALSE;
+ container->resize_mode = GTK_RESIZE_PARENT;
container->resize_widgets = NULL;
}
static void
gtk_container_destroy (GtkObject *object)
{
- GSList *node;
-
+ GtkContainer *container;
+
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_CONTAINER (object));
- for (node = GTK_CONTAINER (object)->resize_widgets; node; node = node->next)
- {
- GtkWidget *child;
-
- child = (GtkWidget*) node->data;
- GTK_PRIVATE_UNSET_FLAG (child, GTK_RESIZE_NEEDED);
- }
- g_slist_free (GTK_CONTAINER (object)->resize_widgets);
- GTK_CONTAINER (object)->resize_widgets = NULL;
+ container = GTK_CONTAINER (object);
- gtk_container_foreach (GTK_CONTAINER (object),
+ gtk_container_clear_resize_widgets (container);
+
+ gtk_container_foreach (container,
(GtkCallback) gtk_widget_destroy, NULL);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
case ARG_BORDER_WIDTH:
gtk_container_border_width (container, GTK_VALUE_ULONG (*arg));
break;
- case ARG_AUTO_RESIZE:
- if (GTK_VALUE_BOOL (*arg))
- gtk_container_enable_resize (container);
- else
- gtk_container_disable_resize (container);
- break;
- case ARG_BLOCK_RESIZE:
- if (GTK_VALUE_BOOL (*arg))
- gtk_container_block_resize (container);
- else
- gtk_container_unblock_resize (container);
- break;
case ARG_CHILD:
gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
break;
case ARG_BORDER_WIDTH:
GTK_VALUE_ULONG (*arg) = container->border_width;
break;
- case ARG_AUTO_RESIZE:
- GTK_VALUE_BOOL (*arg) = container->auto_resize;
- break;
- case ARG_BLOCK_RESIZE:
- GTK_VALUE_BOOL (*arg) = container->block_resize;
- break;
default:
arg->type = GTK_TYPE_INVALID;
break;
void
gtk_container_disable_resize (GtkContainer *container)
+{
+ g_warning ("gtk_container_disable_resize does nothing!");
+}
+
+void
+gtk_container_enable_resize (GtkContainer *container)
+{
+ g_warning ("gtk_container_enable_resize does nothing!");
+}
+
+void
+gtk_container_block_resize (GtkContainer *container)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
- container->auto_resize = FALSE;
}
void
-gtk_container_enable_resize (GtkContainer *container)
+gtk_container_unblock_resize (GtkContainer *container)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
+
+}
+
+void
+gtk_container_clear_resize_widgets (GtkContainer *container)
+{
+ GSList *node;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
- container->auto_resize = TRUE;
- if (container->need_resize)
+ node = container->resize_widgets;
+
+ while (node)
{
- container->need_resize = FALSE;
- gtk_widget_queue_resize (GTK_WIDGET (container));
+ GtkWidget *widget = node->data;
+
+ GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
+ node = node->next;
}
+
+ g_slist_free (container->resize_widgets);
+ container->resize_widgets = NULL;
}
void
-gtk_container_block_resize (GtkContainer *container)
+gtk_container_set_resize_mode (GtkContainer *container,
+ GtkResizeMode resize_mode)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (!(GTK_WIDGET_TOPLEVEL (container) &&
+ resize_mode == GTK_RESIZE_PARENT));
+
+ container->resize_mode = resize_mode;
- container->block_resize = TRUE;
+ if (container->resize_widgets != NULL)
+ {
+ if (resize_mode == GTK_RESIZE_IMMEDIATE)
+ gtk_container_check_resize (container);
+ else if (resize_mode == GTK_RESIZE_PARENT)
+ {
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ container->resize_widgets = NULL;
+ }
+ }
}
void
-gtk_container_unblock_resize (GtkContainer *container)
+gtk_container_check_resize (GtkContainer *container)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
+
+ gtk_signal_emit (GTK_OBJECT (container), container_signals[CHECK_RESIZE]);
+}
+
+gint
+gtk_container_need_resize (GtkContainer *container)
+{
+ gtk_container_check_resize (container);
+ return TRUE;
+}
+
+static void
+gtk_container_real_check_resize (GtkContainer *container)
+{
+ GtkWidget *widget;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+
+ widget = GTK_WIDGET (container);
+
+ gtk_widget_size_request (widget, &widget->requisition);
- container->block_resize = FALSE;
+ if ((widget->requisition.width > widget->allocation.width) ||
+ (widget->requisition.height > widget->allocation.height))
+ {
+ gtk_container_clear_resize_widgets (container);
+ gtk_widget_queue_resize (widget);
+ }
+ else
+ {
+ gtk_container_resize_children (container);
+ }
}
-gint
-gtk_container_need_resize (GtkContainer *container)
+/* The window hasn't changed size but one of its children
+ * queued a resize request. Which means that the allocation
+ * is not sufficient for the requisition of some child.
+ * We've already performed a size request at this point,
+ * so we simply need to run through the list of resize
+ * widgets and reallocate their sizes appropriately. We
+ * make the optimization of not performing reallocation
+ * for a widget who also has a parent in the resize widgets
+ * list. GTK_RESIZE_NEEDED is used for flagging those
+ * parents inside this function.
+ */
+void
+gtk_container_resize_children (GtkContainer *container)
{
- gint return_val;
+ GtkWidget *widget;
+ GSList *resize_widgets;
+ GSList *resize_containers;
+ GSList *node;
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
+ resize_widgets = container->resize_widgets;
+ container->resize_widgets = NULL;
- return_val = FALSE;
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+
+ for (node = resize_widgets; node; node = node->next)
+ {
+ widget = node->data;
+
+ GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
+
+ while (widget && widget->parent &&
+ ((widget->allocation.width < widget->requisition.width) ||
+ (widget->allocation.height < widget->requisition.height)))
+ widget = widget->parent;
+
+ GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
+ node->data = widget;
+ }
+
+ resize_containers = NULL;
- if (!container->block_resize)
+ for (node = resize_widgets; node; node = node->next)
{
- if (container->auto_resize)
- gtk_signal_emit (GTK_OBJECT (container),
- container_signals[NEED_RESIZE],
- &return_val);
+ GtkWidget *resize_container;
+
+ widget = node->data;
+
+ if (!GTK_WIDGET_RESIZE_NEEDED (widget))
+ continue;
+
+ resize_container = widget->parent;
+
+ if (resize_container)
+ {
+ GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
+ widget = resize_container->parent;
+
+ while (widget)
+ {
+ if (GTK_WIDGET_RESIZE_NEEDED (widget))
+ {
+ GTK_PRIVATE_UNSET_FLAG (resize_container, GTK_RESIZE_NEEDED);
+ resize_container = widget;
+ }
+ widget = widget->parent;
+ }
+ }
else
- container->need_resize = TRUE;
+ resize_container = widget;
+
+ if (!g_slist_find (resize_containers, resize_container))
+ resize_containers = g_slist_prepend (resize_containers,
+ resize_container);
}
+ g_slist_free (resize_widgets);
- return return_val;
+ for (node = resize_containers; node; node = node->next)
+ {
+ widget = node->data;
+
+ GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
+ gtk_widget_size_allocate (widget, &widget->allocation);
+ gtk_widget_queue_draw (widget);
+ }
+ g_slist_free (resize_containers);
}
void
*return_val = (* rfunc) (object, GTK_VALUE_ENUM(args[0]), func_data);
}
-static void
-gtk_container_marshal_signal_4 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkContainerSignal4 rfunc;
- gint *return_val;
-
- rfunc = (GtkContainerSignal4) func;
- return_val = GTK_RETLOC_BOOL (args[0]);
-
- *return_val = (* rfunc) (object, func_data);
-}
-
-static gint
-gtk_container_real_need_resize (GtkContainer *container)
-{
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
-
- if (GTK_WIDGET_VISIBLE (container) && container->widget.parent)
- return gtk_container_need_resize (GTK_CONTAINER (container->widget.parent));
-
- return FALSE;
-}
-
static gint
gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction)
GtkWidget *focus_child;
guint border_width : 16;
- guint auto_resize : 1;
guint need_resize : 1;
- guint block_resize : 1;
+ guint resize_mode : 2;
/* The list of children that requested a resize
GtkWidget *widget);
void (* remove) (GtkContainer *container,
GtkWidget *widget);
- gint (* need_resize) (GtkContainer *container);
+ void (* check_resize) (GtkContainer *container);
void (* foreach) (GtkContainer *container,
GtkCallback callback,
gpointer callbabck_data);
guint arg_id);
};
+/* Application-level methods */
GtkType gtk_container_get_type (void);
void gtk_container_border_width (GtkContainer *container,
GtkWidget *widget);
void gtk_container_remove (GtkContainer *container,
GtkWidget *widget);
-void gtk_container_disable_resize (GtkContainer *container);
-void gtk_container_enable_resize (GtkContainer *container);
-void gtk_container_block_resize (GtkContainer *container);
-void gtk_container_unblock_resize (GtkContainer *container);
-gint gtk_container_need_resize (GtkContainer *container);
+
+void gtk_container_set_resize_mode (GtkContainer *container,
+ GtkResizeMode resize_mode);
+
+void gtk_container_check_resize (GtkContainer *container);
+
void gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
gpointer callback_data,
GtkDestroyNotify notify);
GList* gtk_container_children (GtkContainer *container);
-void gtk_container_register_toplevel (GtkContainer *container);
-void gtk_container_unregister_toplevel (GtkContainer *container);
gint gtk_container_focus (GtkContainer *container,
GtkDirectionType direction);
+
+/* Widget-level methods */
+
void gtk_container_set_focus_child (GtkContainer *container,
GtkWidget *child);
void gtk_container_set_focus_vadjustment (GtkContainer *container,
GtkAdjustment *adjustment);
void gtk_container_set_focus_hadjustment (GtkContainer *container,
GtkAdjustment *adjustment);
+void gtk_container_register_toplevel (GtkContainer *container);
+void gtk_container_unregister_toplevel (GtkContainer *container);
+void gtk_container_resize_children (GtkContainer *container);
GtkType gtk_container_child_type (GtkContainer *container);
GtkArg *args);
+/* Non-public methods */
+void gtk_container_clear_resize_widgets (GtkContainer *container);
+
+/* Deprecated methods */
+/* completely non-functional */
+void gtk_container_disable_resize (GtkContainer *container);
+void gtk_container_enable_resize (GtkContainer *container);
+
+/* Use gtk_container_set_resize_mode() instead */
+void gtk_container_block_resize (GtkContainer *container);
+void gtk_container_unblock_resize (GtkContainer *container);
+/* Use gtk_container_check_resize() instead */
+gint gtk_container_need_resize (GtkContainer *container);
#ifdef __cplusplus
}
#define INNER_BORDER 2
enum {
- ACTIVATE,
CHANGED,
INSERT_TEXT,
DELETE_TEXT,
+ /* Binding actions */
+ ACTIVATE,
+ MOVE_CURSOR,
+ MOVE_WORD,
+ MOVE_PAGE,
+ MOVE_TO_ROW,
+ MOVE_TO_COLUMN,
+ KILL_CHAR,
+ KILL_WORD,
+ KILL_LINE,
+ CUT_CLIPBOARD,
+ COPY_CLIPBOARD,
+ PASTE_CLIPBOARD,
LAST_SIGNAL
};
-static void gtk_editable_class_init (GtkEditableClass *klass);
-static void gtk_editable_init (GtkEditable *editable);
-static void gtk_editable_finalize (GtkObject *object);
-static gint gtk_editable_selection_clear (GtkWidget *widget,
- GdkEventSelection *event);
-static void gtk_editable_selection_handler (GtkWidget *widget,
- GtkSelectionData *selection_data,
- gpointer data);
-static void gtk_editable_selection_received (GtkWidget *widget,
- GtkSelectionData *selection_data);
-
-static void gtk_editable_set_selection (GtkEditable *editable,
- gint start,
- gint end);
+static void gtk_editable_class_init (GtkEditableClass *klass);
+static void gtk_editable_init (GtkEditable *editable);
+static void gtk_editable_finalize (GtkObject *object);
+static gint gtk_editable_selection_clear (GtkWidget *widget,
+ GdkEventSelection *event);
+static void gtk_editable_selection_handler (GtkWidget *widget,
+ GtkSelectionData *selection_data,
+ gpointer data);
+static void gtk_editable_selection_received (GtkWidget *widget,
+ GtkSelectionData *selection_data);
+
+static void gtk_editable_set_selection (GtkEditable *editable,
+ gint start,
+ gint end);
+static guint32 gtk_editable_get_event_time (GtkEditable *editable);
+
+static void gtk_real_editable_cut_clipboard (GtkEditable *editable);
+static void gtk_real_editable_copy_clipboard (GtkEditable *editable);
+static void gtk_real_editable_paste_clipboard (GtkEditable *editable);
+
static void gtk_editable_marshal_signal_1 (GtkObject * object,
GtkSignalFunc func,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args);
+static void gtk_editable_marshal_signal_3 (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg * args);
static GtkWidgetClass *parent_class = NULL;
static guint editable_signals[LAST_SIGNAL] = { 0 };
static GdkAtom text_atom = GDK_NONE;
static GdkAtom clipboard_atom = GDK_NONE;
-typedef void (*GtkTextSignal1) (GtkObject * object,
+typedef void (*GtkEditableSignal1) (GtkObject * object,
gchar *arg1,
gint arg2,
gint *arg3,
gpointer data);
-typedef void (*GtkTextSignal2) (GtkObject * object,
+typedef void (*GtkEditableSignal2) (GtkObject * object,
gint arg1,
gint arg2,
gpointer data);
+typedef void (*GtkEditableSignal3) (GtkObject * object,
+ gint arg1,
+ gpointer data);
+
guint
gtk_editable_get_type (void)
{
parent_class = gtk_type_class (gtk_widget_get_type ());
- editable_signals[ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkEditableClass, activate),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
editable_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
GTK_TYPE_INT,
GTK_TYPE_INT);
+ editable_signals[ACTIVATE] =
+ gtk_signal_new ("activate",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, activate),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+
+ editable_signals[MOVE_CURSOR] =
+ gtk_signal_new ("move_cursor",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, move_cursor),
+ gtk_editable_marshal_signal_2,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT,
+ GTK_TYPE_INT);
+
+ editable_signals[MOVE_WORD] =
+ gtk_signal_new ("move_word",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, move_word),
+ gtk_editable_marshal_signal_3,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ editable_signals[MOVE_PAGE] =
+ gtk_signal_new ("move_page",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, move_page),
+ gtk_editable_marshal_signal_2,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT,
+ GTK_TYPE_INT);
+
+ editable_signals[MOVE_TO_ROW] =
+ gtk_signal_new ("move_to_row",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_row),
+ gtk_editable_marshal_signal_3,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ editable_signals[MOVE_TO_COLUMN] =
+ gtk_signal_new ("move_to_column",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_column),
+ gtk_editable_marshal_signal_3,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ editable_signals[KILL_CHAR] =
+ gtk_signal_new ("kill_char",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, kill_char),
+ gtk_editable_marshal_signal_3,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ editable_signals[KILL_WORD] =
+ gtk_signal_new ("kill_word",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, kill_word),
+ gtk_editable_marshal_signal_3,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ editable_signals[KILL_LINE] =
+ gtk_signal_new ("kill_line",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, kill_line),
+ gtk_editable_marshal_signal_3,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ editable_signals[CUT_CLIPBOARD] =
+ gtk_signal_new ("cut_clipboard",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, cut_clipboard),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+
+ editable_signals[COPY_CLIPBOARD] =
+ gtk_signal_new ("copy_clipboard",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, copy_clipboard),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+
+ editable_signals[PASTE_CLIPBOARD] =
+ gtk_signal_new ("paste_clipboard",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEditableClass, paste_clipboard),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, editable_signals, LAST_SIGNAL);
object_class->finalize = gtk_editable_finalize;
class->insert_text = NULL;
class->delete_text = NULL;
+ class->changed = NULL;
+
+ class->activate = NULL;
+
+ class->move_cursor = NULL;
+ class->move_word = NULL;
+ class->move_page = NULL;
+ class->move_to_row = NULL;
+ class->move_to_column = NULL;
+
+ class->kill_char = NULL;
+ class->kill_word = NULL;
+ class->kill_line = NULL;
+
+ class->cut_clipboard = gtk_real_editable_cut_clipboard;
+ class->copy_clipboard = gtk_real_editable_copy_clipboard;
+ class->paste_clipboard = gtk_real_editable_paste_clipboard;
+
class->update_text = NULL;
class->get_chars = NULL;
class->set_selection = NULL;
- class->changed = NULL;
+ class->set_position = NULL;
}
static void
gtk_editable_set_selection (editable, start, end);
}
+/* Get the timestamp of the current event. Actually, the only thing
+ * we really care about below is the key event
+ */
+static guint32
+gtk_editable_get_event_time (GtkEditable *editable)
+{
+ GdkEvent *event;
+
+ event = gtk_get_current_event();
+
+ if (event)
+ switch (event->type)
+ {
+ case GDK_MOTION_NOTIFY:
+ return event->motion.time;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ return event->button.time;
+ case GDK_KEY_PRESS:
+ case GDK_KEY_RELEASE:
+ return event->key.time;
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ return event->crossing.time;
+ case GDK_PROPERTY_NOTIFY:
+ return event->property.time;
+ case GDK_SELECTION_CLEAR:
+ case GDK_SELECTION_REQUEST:
+ case GDK_SELECTION_NOTIFY:
+ return event->selection.time;
+ case GDK_PROXIMITY_IN:
+ case GDK_PROXIMITY_OUT:
+ return event->proximity.time;
+ default: /* use current time */
+ }
+
+ return GDK_CURRENT_TIME;
+}
+
void
-gtk_editable_cut_clipboard (GtkEditable *editable, guint32 time)
+gtk_editable_cut_clipboard (GtkEditable *editable)
{
- gtk_editable_copy_clipboard (editable, time);
- gtk_editable_delete_selection (editable);
+ gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CUT_CLIPBOARD]);
+}
+
+void
+gtk_editable_copy_clipboard (GtkEditable *editable)
+{
+ gtk_signal_emit (GTK_OBJECT (editable), editable_signals[COPY_CLIPBOARD]);
}
void
-gtk_editable_copy_clipboard (GtkEditable *editable, guint32 time)
+gtk_editable_paste_clipboard (GtkEditable *editable)
{
+ gtk_signal_emit (GTK_OBJECT (editable), editable_signals[PASTE_CLIPBOARD]);
+}
+
+static void
+gtk_real_editable_cut_clipboard (GtkEditable *editable)
+{
+ gtk_real_editable_copy_clipboard (editable);
+ gtk_editable_delete_selection (editable);
+}
+
+static void
+gtk_real_editable_copy_clipboard (GtkEditable *editable)
+{
+ guint32 time = gtk_editable_get_event_time (editable);
+
gint selection_start_pos;
gint selection_end_pos;
}
}
-void
-gtk_editable_paste_clipboard (GtkEditable *editable, guint32 time)
+static void
+gtk_real_editable_paste_clipboard (GtkEditable *editable)
{
+ guint32 time = gtk_editable_get_event_time (editable);
+
if (editable->editable)
gtk_selection_convert (GTK_WIDGET(editable),
clipboard_atom, ctext_atom, time);
gpointer func_data,
GtkArg * args)
{
- GtkTextSignal1 rfunc;
+ GtkEditableSignal1 rfunc;
- rfunc = (GtkTextSignal1) func;
+ rfunc = (GtkEditableSignal1) func;
(*rfunc) (object, GTK_VALUE_STRING (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
+ GTK_VALUE_INT (args[1]),
+ GTK_VALUE_POINTER (args[2]),
func_data);
}
gpointer func_data,
GtkArg * args)
{
- GtkTextSignal2 rfunc;
+ GtkEditableSignal2 rfunc;
+
+ rfunc = (GtkEditableSignal2) func;
+
+ (*rfunc) (object, GTK_VALUE_INT (args[0]),
+ GTK_VALUE_INT (args[1]),
+ func_data);
+}
+
+static void
+gtk_editable_marshal_signal_3 (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg * args)
+{
+ GtkEditableSignal3 rfunc;
- rfunc = (GtkTextSignal2) func;
+ rfunc = (GtkEditableSignal3) func;
(*rfunc) (object, GTK_VALUE_INT (args[0]),
- GTK_VALUE_INT (args[1]),
func_data);
}
struct _GtkEditableClass
{
GtkWidgetClass parent_class;
-
+
+ /* Signals for notification/filtering of changes */
+ void (* changed) (GtkEditable *editable);
void (* insert_text) (GtkEditable *editable,
const gchar *text,
gint length,
void (* delete_text) (GtkEditable *editable,
gint start_pos,
gint end_pos);
+
+ /* Bindings actions */
+ void (* activate) (GtkEditable *editable);
+ void (* move_cursor) (GtkEditable *editable,
+ gint x,
+ gint y);
+ void (* move_word) (GtkEditable *editable,
+ gint n);
+ void (* move_page) (GtkEditable *editable,
+ gint x,
+ gint y);
+ void (* move_to_row) (GtkEditable *editable,
+ gint row);
+ void (* move_to_column) (GtkEditable *editable,
+ gint row);
+ void (* kill_char) (GtkEditable *editable,
+ gint direction);
+ void (* kill_word) (GtkEditable *editable,
+ gint direction);
+ void (* kill_line) (GtkEditable *editable,
+ gint direction);
+ void (* cut_clipboard) (GtkEditable *editable);
+ void (* copy_clipboard) (GtkEditable *editable);
+ void (* paste_clipboard) (GtkEditable *editable);
+
+ /* Virtual functions. get_chars is in paricular not a signal because
+ * it returns malloced memory. The others are not signals because
+ * they would not be particularly useful as such. (All changes to
+ * selection and position do not go through these functions)
+ */
void (* update_text) (GtkEditable *editable,
gint start_pos,
gint end_pos);
void (* set_selection)(GtkEditable *editable,
gint start_pos,
gint end_pos);
- void (* activate) (GtkEditable *editable);
- void (* changed) (GtkEditable *editable);
void (* set_position) (GtkEditable *editable,
gint position);
};
gchar * gtk_editable_get_chars (GtkEditable *editable,
gint start_pos,
gint end_pos);
-void gtk_editable_cut_clipboard (GtkEditable *editable,
- guint32 time);
-void gtk_editable_copy_clipboard (GtkEditable *editable,
- guint32 time);
-void gtk_editable_paste_clipboard (GtkEditable *editable,
- guint32 time);
+void gtk_editable_cut_clipboard (GtkEditable *editable);
+void gtk_editable_copy_clipboard (GtkEditable *editable);
+void gtk_editable_paste_clipboard (GtkEditable *editable);
void gtk_editable_claim_selection (GtkEditable *editable,
gboolean claim,
guint32 time);
gint start_pos,
gint end_pos);
+/* Binding actions */
+static void gtk_entry_move_cursor (GtkEditable *editable,
+ gint x,
+ gint y);
+static void gtk_entry_move_word (GtkEditable *editable,
+ gint n);
+static void gtk_entry_move_to_column (GtkEditable *editable,
+ gint row);
+static void gtk_entry_kill_char (GtkEditable *editable,
+ gint direction);
+static void gtk_entry_kill_word (GtkEditable *editable,
+ gint direction);
+static void gtk_entry_kill_line (GtkEditable *editable,
+ gint direction);
+
+/* To be removed */
static void gtk_move_forward_character (GtkEntry *entry);
static void gtk_move_backward_character (GtkEntry *entry);
static void gtk_move_forward_word (GtkEntry *entry);
{
(GtkTextFunction)gtk_move_beginning_of_line, /* a */
(GtkTextFunction)gtk_move_backward_character, /* b */
- gtk_editable_copy_clipboard, /* c */
+ (GtkTextFunction)gtk_editable_copy_clipboard, /* c */
(GtkTextFunction)gtk_delete_forward_character, /* d */
(GtkTextFunction)gtk_move_end_of_line, /* e */
(GtkTextFunction)gtk_move_forward_character, /* f */
NULL, /* s */
NULL, /* t */
(GtkTextFunction)gtk_delete_line, /* u */
- gtk_editable_paste_clipboard, /* v */
+ (GtkTextFunction)gtk_editable_paste_clipboard, /* v */
(GtkTextFunction)gtk_delete_backward_word, /* w */
- gtk_editable_cut_clipboard, /* x */
+ (GtkTextFunction)gtk_editable_cut_clipboard, /* x */
NULL, /* y */
NULL, /* z */
};
editable_class->insert_text = gtk_entry_insert_text;
editable_class->delete_text = gtk_entry_delete_text;
+ editable_class->changed = (void (*)(GtkEditable *)) gtk_entry_adjust_scroll;
+
+ editable_class->move_cursor = gtk_entry_move_cursor;
+ editable_class->move_word = gtk_entry_move_word;
+ editable_class->move_to_column = gtk_entry_move_to_column;
+
+ editable_class->kill_char = gtk_entry_kill_char;
+ editable_class->kill_word = gtk_entry_kill_word;
+ editable_class->kill_line = gtk_entry_kill_line;
+
editable_class->update_text = gtk_entry_update_text;
editable_class->get_chars = gtk_entry_get_chars;
editable_class->set_selection = gtk_entry_set_selection;
- editable_class->changed = (void (*)(GtkEditable *)) gtk_entry_adjust_scroll;
- editable_class->activate = NULL;
editable_class->set_position = gtk_entry_set_position_from_editable;
}
if (event->state & GDK_SHIFT_MASK)
{
extend_selection = FALSE;
- gtk_editable_paste_clipboard (editable, event->time);
+ gtk_editable_paste_clipboard (editable);
}
else if (event->state & GDK_CONTROL_MASK)
{
- gtk_editable_copy_clipboard (editable, event->time);
+ gtk_editable_copy_clipboard (editable);
}
else
{
else if (event->state & GDK_SHIFT_MASK)
{
extend_selection = FALSE;
- gtk_editable_cut_clipboard (editable, event->time);
+ gtk_editable_cut_clipboard (editable);
}
else
gtk_delete_forward_character (entry);
return NULL;
}
-static void
-gtk_move_forward_character (GtkEntry *entry)
+static void
+gtk_entry_move_cursor (GtkEditable *editable,
+ gint x,
+ gint y)
{
gint len;
- GtkEditable *editable;
- editable = GTK_EDITABLE (entry);
+ GtkEntry *entry;
+ entry = GTK_ENTRY (editable);
- if (gtk_use_mb)
+ /* Horizontal motion */
+ if (x > 0)
{
- if (editable->current_pos < entry->text_length)
+ while (x-- != 0)
{
- len = mblen (entry->text+editable->current_pos, MB_CUR_MAX);
- editable->current_pos += (len>0)? len:1;
+ if (gtk_use_mb)
+ {
+ if (editable->current_pos < entry->text_length)
+ {
+ len = mblen (entry->text+editable->current_pos, MB_CUR_MAX);
+ editable->current_pos += (len>0)? len:1;
+ }
+ if (editable->current_pos > entry->text_length)
+ editable->current_pos = entry->text_length;
+ }
+ else
+ {
+ if (editable->current_pos < entry->text_length)
+ editable->current_pos ++;
+ }
}
- if (editable->current_pos > entry->text_length)
- editable->current_pos = entry->text_length;
}
- else
+ else if (x < 0)
{
- if (editable->current_pos < entry->text_length)
- editable->current_pos ++;
+ while (x++ != 0)
+ {
+ if (0 < editable->current_pos)
+ {
+ if (gtk_use_mb)
+ editable->current_pos =
+ entry->char_pos[gtk_entry_find_char (entry, editable->current_pos - 1)];
+ else
+ editable->current_pos--;
+ }
+ }
}
+
+ /* Ignore vertical motion */
}
static void
-gtk_move_backward_character (GtkEntry *entry)
+gtk_move_forward_character (GtkEntry *entry)
{
- GtkEditable *editable;
+ gtk_entry_move_cursor (GTK_EDITABLE (entry), 1, 0);
+}
- editable = GTK_EDITABLE (entry);
+static void
+gtk_move_backward_character (GtkEntry *entry)
+{
+ gtk_entry_move_cursor (GTK_EDITABLE (entry), -1, 0);
+}
- if (0 < editable->current_pos)
+static void
+gtk_entry_move_word (GtkEditable *editable,
+ gint n)
+{
+ if (n > 0)
{
- if (gtk_use_mb)
- editable->current_pos =
- entry->char_pos[gtk_entry_find_char (entry, editable->current_pos - 1)];
- else
- editable->current_pos--;
+ while (n-- != 0)
+ gtk_move_forward_word (GTK_ENTRY (editable));
+ }
+ else if (n < 0)
+ {
+ while (n++ != 0)
+ gtk_move_backward_word (GTK_ENTRY (editable));
}
}
}
}
+static void
+gtk_entry_move_to_column (GtkEditable *editable, gint column)
+{
+ GtkEntry *entry;
+
+ entry = GTK_ENTRY (editable);
+
+ if (column < 0 || column > entry->nchars)
+ editable->current_pos = entry->text_length;
+ else
+ editable->current_pos = entry->char_pos[column];
+}
+
static void
gtk_move_beginning_of_line (GtkEntry *entry)
{
- GTK_EDITABLE (entry)->current_pos = 0;
+ gtk_entry_move_to_column (GTK_EDITABLE (entry), 0);
}
static void
gtk_move_end_of_line (GtkEntry *entry)
{
- GTK_EDITABLE (entry)->current_pos = entry->text_length;
+ gtk_entry_move_to_column (GTK_EDITABLE (entry), -1);
}
static void
-gtk_delete_forward_character (GtkEntry *entry)
+gtk_entry_kill_char (GtkEditable *editable,
+ gint direction)
{
- GtkEditable *editable;
- gint old_pos;
-
- editable = GTK_EDITABLE (entry);
-
if (editable->selection_start_pos != editable->selection_end_pos)
gtk_editable_delete_selection (editable);
else
{
- old_pos = editable->current_pos;
- gtk_move_forward_character (entry);
- gtk_editable_delete_text (editable, old_pos, editable->current_pos);
+ gint old_pos = editable->current_pos;
+ if (direction >= 0)
+ {
+ gtk_entry_move_cursor (editable, 1, 0);
+ gtk_editable_delete_text (editable, old_pos, editable->current_pos);
+ }
+ else
+ {
+ gtk_entry_move_cursor (editable, -1, 0);
+ gtk_editable_delete_text (editable, editable->current_pos, old_pos);
+ }
}
}
static void
-gtk_delete_backward_character (GtkEntry *entry)
+gtk_delete_forward_character (GtkEntry *entry)
{
- GtkEditable *editable;
- gint old_pos;
+ gtk_entry_kill_char (GTK_EDITABLE (entry), 1);
+}
- editable = GTK_EDITABLE (entry);
+static void
+gtk_delete_backward_character (GtkEntry *entry)
+{
+ gtk_entry_kill_char (GTK_EDITABLE (entry), -1);
+}
+static void
+gtk_entry_kill_word (GtkEditable *editable,
+ gint direction)
+{
if (editable->selection_start_pos != editable->selection_end_pos)
gtk_editable_delete_selection (editable);
else
{
- old_pos = editable->current_pos;
- gtk_move_backward_character (entry);
- gtk_editable_delete_text (editable, editable->current_pos, old_pos);
+ gint old_pos = editable->current_pos;
+ if (direction >= 0)
+ {
+ gtk_entry_move_word (editable, 1);
+ gtk_editable_delete_text (editable, old_pos, editable->current_pos);
+ }
+ else
+ {
+ gtk_entry_move_word (editable, -1);
+ gtk_editable_delete_text (editable, editable->current_pos, old_pos);
+ }
}
}
static void
gtk_delete_forward_word (GtkEntry *entry)
{
- GtkEditable *editable;
- gint old_pos;
-
- editable = GTK_EDITABLE (entry);
-
- if (editable->selection_start_pos != editable->selection_end_pos)
- gtk_editable_delete_selection (editable);
- else
- {
- old_pos = editable->current_pos;
- gtk_move_forward_word (entry);
- gtk_editable_delete_text (editable, old_pos, editable->current_pos);
- }
+ gtk_entry_kill_word (GTK_EDITABLE (entry), 1);
}
static void
gtk_delete_backward_word (GtkEntry *entry)
{
- GtkEditable *editable;
- gint old_pos;
-
- editable = GTK_EDITABLE (entry);
+ gtk_entry_kill_word (GTK_EDITABLE (entry), -1);
+}
- if (editable->selection_start_pos != editable->selection_end_pos)
- gtk_editable_delete_selection (editable);
+static void
+gtk_entry_kill_line (GtkEditable *editable,
+ gint direction)
+{
+ gint old_pos = editable->current_pos;
+ if (direction >= 0)
+ {
+ gtk_entry_move_to_column (editable, -1);
+ gtk_editable_delete_text (editable, old_pos, editable->current_pos);
+ }
else
{
- old_pos = editable->current_pos;
- gtk_move_backward_word (entry);
+ gtk_entry_move_to_column (editable, 0);
gtk_editable_delete_text (editable, editable->current_pos, old_pos);
}
}
static void
gtk_delete_line (GtkEntry *entry)
{
- gtk_editable_delete_text (GTK_EDITABLE(entry), 0, entry->text_length);
+ gtk_entry_move_to_column (GTK_EDITABLE (entry), 0);
+ gtk_entry_kill_line (GTK_EDITABLE (entry), 1);
}
static void
GTK_RELIEF_NONE
} GtkReliefStyle;
+/* Resize type */
+typedef enum
+{
+ GTK_RESIZE_PARENT, /* Pass resize request to the parent */
+ GTK_RESIZE_QUEUE, /* Queue resizes on this widget */
+ GTK_RESIZE_IMMEDIATE, /* Perform the resizes now */
+} GtkResizeMode;
+
/* signal run types */
typedef enum /*< flags >*/
{
guint16 *pixel_sizes;
guint16 *point_sizes;
- /* These are the arrays of all possible weights/slants/set widths/spacings
- and the amount of space allocated for each array. The extra array is
- used for the foundries strings. */
+ /* These are the arrays of strings of all possible weights, slants,
+ set widths, spacings, charsets & foundries, and the amount of space
+ allocated for each array. */
gchar **properties[GTK_NUM_FONT_PROPERTIES];
guint16 nproperties[GTK_NUM_FONT_PROPERTIES];
guint16 space_allocated[GTK_NUM_FONT_PROPERTIES];
- /* Whether any scalable bitmap fonts are available. */
+ /* Whether any scalable bitmap fonts are available. If not, the 'Allow
+ scaled bitmap fonts' toggle button is made insensitive. */
gboolean scaled_bitmaps_available;
};
gint step);
static void gtk_font_selection_show_available_styles
(GtkFontSelection *fs);
-static void gtk_font_selection_select_best_style (GtkFontSelection *fs);
+static void gtk_font_selection_select_best_style (GtkFontSelection *fs,
+ gboolean use_first);
+static gint gtk_font_selection_get_best_match (GtkFontSelection *fs);
static void gtk_font_selection_select_style (GtkWidget *w,
gint row,
gint style);
static void gtk_font_selection_reset_filter (GtkWidget *w,
gpointer data);
-static void gtk_font_selection_toggle_filter (GtkWidget *w,
+static void gtk_font_selection_on_clear_filter (GtkWidget *w,
gpointer data);
static void gtk_font_selection_apply_filter (GtkFontSelection *fs);
static void gtk_font_selection_clear_filter (GtkFontSelection *fs);
fontsel->scroll_on_expose = TRUE;
- /* Create the shell and vertical & horizontal boxes */
+ /* Create the main notebook page. */
fontsel->main_vbox = gtk_vbox_new (FALSE, 4);
gtk_widget_show (fontsel->main_vbox);
gtk_container_border_width (GTK_CONTAINER (fontsel->main_vbox), 6);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (fontsel->main_vbox), hbox, FALSE, TRUE, 0);
- /*
- fontsel->filter_button = gtk_check_button_new_with_label("Filter fonts");
- gtk_widget_show(fontsel->filter_button);
- gtk_box_pack_start (GTK_BOX (hbox), fontsel->filter_button, FALSE, FALSE, 0);
- gtk_widget_set_sensitive (fontsel->filter_button, FALSE);
- gtk_signal_connect (GTK_OBJECT (fontsel->filter_button), "clicked",
- GTK_SIGNAL_FUNC(gtk_font_selection_toggle_filter),
- fontsel);
- */
-
fontsel->filter_button = gtk_button_new_with_label(" Clear Filter ");
gtk_widget_show(fontsel->filter_button);
gtk_box_pack_start (GTK_BOX (hbox), fontsel->filter_button, FALSE, FALSE, 0);
gtk_widget_set_sensitive (fontsel->filter_button, FALSE);
gtk_signal_connect (GTK_OBJECT (fontsel->filter_button), "clicked",
- GTK_SIGNAL_FUNC(gtk_font_selection_toggle_filter),
+ GTK_SIGNAL_FUNC(gtk_font_selection_on_clear_filter),
fontsel);
fontsel->scaled_bitmaps_button
gtk_clist_freeze (GTK_CLIST(fontsel->info_clist));
row_text[1] = "";
row_text[2] = "";
- /* Note: we skip the last field, encoding, since it is shown as part of the
- charset. */
for (i = 0; i < GTK_XLFD_NUM_FIELDS; i++)
{
row_text[0] = xlfd_field_names[i];
GTK_POLICY_AUTOMATIC);
gtk_widget_show(clist);
- /* For the bottom-right cell we add the 'Reset' button. */
+ /* For the bottom-right cell we add the 'Clear Filter' button. */
if (top == 2 && left == 2)
{
vbox = gtk_vbox_new(FALSE, 0);
gtk_widget_show(alignment);
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, TRUE, 4);
- button = gtk_button_new_with_label("Reset");
+ button = gtk_button_new_with_label("Clear Filter");
gtk_widget_show(button);
gtk_container_add(GTK_CONTAINER(alignment), button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
fontsel->font_index = row;
gtk_font_selection_show_available_styles (fontsel);
- gtk_font_selection_select_best_style (fontsel);
+ gtk_font_selection_select_best_style (fontsel, TRUE);
}
However, the interface is so easy to use now I'm not sure it's worth it.
Note: This will load a font. */
static void
-gtk_font_selection_select_best_style(GtkFontSelection *fontsel)
+gtk_font_selection_select_best_style(GtkFontSelection *fontsel,
+ gboolean use_first)
{
FontInfo *font;
FontStyle *styles;
- gint row, prop, style;
+ gint row, prop, style = -1, style_to_find;
+ gboolean found = FALSE;
#ifdef FONTSEL_DEBUG
g_print("In select_best_style\n");
font = &fontsel_info->font_info[fontsel->font_index];
styles = &fontsel_info->font_styles[font->style_index];
- style = -1; /* Quite warning */
+ /* If use_first is set, we just find the first style in the list, not
+ including charset items. */
+ style_to_find = use_first ? -1 : gtk_font_selection_get_best_match (fontsel);
+
for (row = 0; row < GTK_CLIST(fontsel->font_style_clist)->rows; row++)
{
style = GPOINTER_TO_INT (gtk_clist_get_row_data (GTK_CLIST (fontsel->font_style_clist), row));
- if (style >= 0)
- break;
+ if (style != -1 && (style_to_find == -1 || style_to_find == style))
+ {
+ found = TRUE;
+ break;
+ }
}
- g_return_if_fail (style != -1);
+ g_return_if_fail (found);
fontsel->style = style;
fontsel->property_values[prop] = styles[fontsel->style].properties[prop];
gtk_clist_select_row(GTK_CLIST(fontsel->font_style_clist), row, 0);
+ if (gtk_clist_row_is_visible(GTK_CLIST(fontsel->font_style_clist), row)
+ != GTK_VISIBILITY_FULL)
+ gtk_clist_moveto(GTK_CLIST(fontsel->font_style_clist), row, -1, 0.5, 0);
gtk_font_selection_show_available_sizes (fontsel);
gtk_font_selection_select_best_size (fontsel);
}
fontsel->scale_bitmapped_fonts
= GTK_TOGGLE_BUTTON(w)->active ? TRUE : FALSE;
- gtk_font_selection_show_available_sizes (fontsel);
- gtk_font_selection_select_best_size (fontsel);
+ if (fontsel->font_index != -1)
+ {
+ gtk_font_selection_show_available_sizes (fontsel);
+ gtk_font_selection_select_best_size (fontsel);
+ }
}
}
if (!shown_actual_fields)
{
+ gtk_entry_set_text(GTK_ENTRY(fontsel->actual_font_name), "");
for (i = 0; i < GTK_XLFD_NUM_FIELDS; i++)
{
gtk_clist_set_text(GTK_CLIST(fontsel->info_clist), i, 2,
{
gtk_widget_set_sensitive(fontsel->filter_button, FALSE);
gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:");
- /*
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->filter_button),
- FALSE);
- */
gtk_font_selection_apply_filter(fontsel);
}
else
{
gtk_widget_set_sensitive(fontsel->filter_button, TRUE);
gtk_label_set(GTK_LABEL(fontsel->font_label), "Font: [Filtered]");
- /*
- if (GTK_TOGGLE_BUTTON(fontsel->filter_button)->active)
- gtk_font_selection_apply_filter(fontsel);
- else
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->filter_button),
- TRUE);
- */
gtk_font_selection_apply_filter(fontsel);
}
}
/* This clears the filter, showing all fonts and styles again. */
static void
-gtk_font_selection_toggle_filter (GtkWidget *w,
- gpointer data)
+gtk_font_selection_on_clear_filter (GtkWidget *w,
+ gpointer data)
{
GtkFontSelection *fontsel;
fontsel = GTK_FONT_SELECTION(data);
-
- /*
- if (GTK_TOGGLE_BUTTON(fontsel->filter_button)->active)
- gtk_font_selection_apply_filter(fontsel);
- else
- gtk_font_selection_clear_filter(fontsel);
- */
-
gtk_font_selection_clear_filter(fontsel);
- gtk_widget_set_sensitive(fontsel->filter_button, FALSE);
- gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:");
}
fontsel->property_nfilters[prop] = 0;
}
- /* TODO: Delete? */
/* Select all the '*'s on the filter page. */
gtk_font_selection_reset_filter(NULL, fontsel);
+ /* Update the main notebook page. */
+ gtk_widget_set_sensitive(fontsel->filter_button, FALSE);
+ gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:");
+
/* If there is no filter at present just return. */
if (!filtered)
return;
First we check the fontname is valid and try to find the font family
- i.e. the name in the main list. If we can't find that, then just return.
Next we try to set each of the properties according to the fontname.
- Finally we select the font family & style in the clists.
- Note that we have to be careful to make sure any callbacks do not try
- to load the font unless we want them to. This is usually done by
- setting the font/size in the fontsel struct before selecting rows or
- buttons in the interface. The callbacks simply return if the value has
- not changed. */
+ Finally we select the font family & style in the clists. */
gboolean
gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
const gchar *fontname)
gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
/* Clear any current filter. */
- /* TODO: Delete?
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->filter_button),
- FALSE);
- */
gtk_font_selection_clear_filter(fontsel);
- gtk_widget_set_sensitive(fontsel->filter_button, FALSE);
- gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:");
/* Now find the best style match. */
fontsel->font_index = index;
fontsel->scroll_on_expose = TRUE;
gtk_font_selection_show_available_styles (fontsel);
- fontsel->style = gtk_font_selection_get_best_match (fontsel);
-
- gtk_clist_select_row(GTK_CLIST(fontsel->font_style_clist),
- fontsel->style, 0);
- gtk_font_selection_show_available_sizes (fontsel);
-
/* This will load the font. */
- gtk_font_selection_select_best_size (fontsel);
+ gtk_font_selection_select_best_style (fontsel, FALSE);
return TRUE;
}
/* This is the number of properties which we keep in the properties array,
- i.e. Foundry, Weight, Slant, Set Width & Spacing. */
+ i.e. Weight, Slant, Set Width, Spacing, Charset & Foundry. */
#define GTK_NUM_FONT_PROPERTIES 6
/* This is the number of properties each style has i.e. Weight, Slant,
- Set Width & Spacing. Note that Foundry is not included. */
+ Set Width, Spacing & Charset. Note that Foundry is not included,
+ since it is the same for all styles of the same FontInfo. */
#define GTK_NUM_STYLE_PROPERTIES 5
gboolean scale_bitmapped_fonts;
/* These are the current property settings. They are indexes into the
- strings in the class' properties array. */
+ strings in the GtkFontSelInfo properties array. */
guint16 property_values[GTK_NUM_STYLE_PROPERTIES];
/* These hold the arrays of current filter settings for each property.
struct _GtkFontSelectionClass
{
- GtkWindowClass parent_class;
+ GtkNotebookClass parent_class;
};
}
(*argv)[i] = NULL;
}
+ else if (strcmp ("--g-fatal-warnings", (*argv)[i]) == 0)
+ {
+ g_set_warning_handler ((GWarningFunc)g_error);
+ (*argv)[i] = NULL;
+ }
i += 1;
}
GdkEventConfigure *event);
static gint gtk_menu_key_press (GtkWidget *widget,
GdkEventKey *event);
-static gint gtk_menu_need_resize (GtkContainer *container);
+static void gtk_menu_check_resize (GtkContainer *container);
static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
static void gtk_menu_show_all (GtkWidget *widget);
static void gtk_menu_hide_all (GtkWidget *widget);
widget_class->show_all = gtk_menu_show_all;
widget_class->hide_all = gtk_menu_hide_all;
- container_class->need_resize = gtk_menu_need_resize;
+ container_class->check_resize = gtk_menu_check_resize;
menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
menu_shell_class->deactivate = gtk_menu_deactivate;
{
GTK_WIDGET_SET_FLAGS (menu, GTK_TOPLEVEL);
+ gtk_container_set_resize_mode (GTK_CONTAINER (menu), GTK_RESIZE_QUEUE);
+
menu->parent_menu_item = NULL;
menu->old_active_menu_item = NULL;
menu->accel_group = NULL;
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
if (MENU_NEEDS_RESIZE (widget))
- gtk_container_need_resize (GTK_CONTAINER (widget));
+ gtk_container_check_resize (GTK_CONTAINER (widget));
gtk_widget_map (widget);
}
return FALSE;
}
-static gint
-gtk_menu_need_resize (GtkContainer *container)
+static void
+gtk_menu_check_resize (GtkContainer *container)
{
GtkAllocation allocation;
GtkWidget *widget;
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU (container), FALSE);
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_MENU (container));
widget = GTK_WIDGET (container);
}
else
MENU_NEEDS_RESIZE (container) = TRUE;
-
- return FALSE;
}
static void
pixmap->pixmap = NULL;
pixmap->mask = NULL;
+ pixmap->needs_clear = FALSE;
}
GtkWidget*
}
if (GTK_WIDGET_VISIBLE (pixmap))
{
+ /* If we aren't drawing the entire area, clear first */
+ if (GTK_WIDGET_DRAWABLE (pixmap) &&
+ ((mask != NULL) ||
+ (GTK_WIDGET (pixmap)->requisition.width != oldwidth) ||
+ (GTK_WIDGET (pixmap)->requisition.height != oldheight)))
+ {
+ pixmap->needs_clear = TRUE;
+ }
+
if ((GTK_WIDGET (pixmap)->requisition.width != oldwidth) ||
(GTK_WIDGET (pixmap)->requisition.height != oldheight))
gtk_widget_queue_resize (GTK_WIDGET (pixmap));
pixmap = GTK_PIXMAP (widget);
misc = GTK_MISC (widget);
+ if (pixmap->needs_clear)
+ {
+ gdk_window_clear_area (GTK_WIDGET (pixmap)->window,
+ GTK_WIDGET (pixmap)->allocation.x,
+ GTK_WIDGET (pixmap)->allocation.y,
+ GTK_WIDGET (pixmap)->allocation.width,
+ GTK_WIDGET (pixmap)->allocation.height);
+
+ pixmap->needs_clear = FALSE;
+ }
+
x = (widget->allocation.x * (1.0 - misc->xalign) +
(widget->allocation.x + widget->allocation.width
- (widget->requisition.width - misc->xpad * 2)) *
GdkPixmap *pixmap;
GdkBitmap *mask;
+
+ guint needs_clear : 1;
};
struct _GtkPixmapClass
scrolled_window = GTK_SCROLLED_WINDOW (widget);
widget->allocation = *allocation;
- gtk_container_disable_resize (GTK_CONTAINER (scrolled_window));
-
if (scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
scrolled_window->hscrollbar_visible = TRUE;
if (scrolled_window->vscrollbar_policy == GTK_POLICY_ALWAYS)
if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
gtk_widget_hide (scrolled_window->vscrollbar);
}
-
- gtk_container_enable_resize (GTK_CONTAINER (scrolled_window));
}
static void
void gtk_signal_set_funcs (GtkSignalMarshal marshal_func,
GtkSignalDestroy destroy_func);
-/* Report internal information about a signal. The caller has the response
- * to invoke a supsequent g_free (returned_data); but must leave the
- * contents of GtkSignalQuery untouched.
+/* Report internal information about a signal. The caller has the
+ * responsibility to invoke a supsequent g_free (returned_data); but
+ * must not modify data pointed to by the members of GtkSignalQuery
*/
GtkSignalQuery* gtk_signal_query (guint signal_id);
static void move_cursor_ver (GtkText *text, int count);
static void move_cursor_hor (GtkText *text, int count);
+/* Binding actions */
+static void gtk_text_move_cursor (GtkEditable *editable,
+ gint x,
+ gint y);
+static void gtk_text_move_word (GtkEditable *editable,
+ gint n);
+static void gtk_text_move_page (GtkEditable *editable,
+ gint x,
+ gint y);
+static void gtk_text_move_to_row (GtkEditable *editable,
+ gint row);
+static void gtk_text_move_to_column (GtkEditable *editable,
+ gint row);
+static void gtk_text_kill_char (GtkEditable *editable,
+ gint direction);
+static void gtk_text_kill_word (GtkEditable *editable,
+ gint direction);
+static void gtk_text_kill_line (GtkEditable *editable,
+ gint direction);
+
+/* To be removed */
static void gtk_text_move_forward_character (GtkText *text);
static void gtk_text_move_backward_character (GtkText *text);
static void gtk_text_move_forward_word (GtkText *text);
{
(GtkTextFunction)gtk_text_move_beginning_of_line, /* a */
(GtkTextFunction)gtk_text_move_backward_character, /* b */
- gtk_editable_copy_clipboard, /* c */
+ (GtkTextFunction)gtk_editable_copy_clipboard, /* c */
(GtkTextFunction)gtk_text_delete_forward_character, /* d */
(GtkTextFunction)gtk_text_move_end_of_line, /* e */
(GtkTextFunction)gtk_text_move_forward_character, /* f */
NULL, /* s */
NULL, /* t */
(GtkTextFunction)gtk_text_delete_line, /* u */
- gtk_editable_paste_clipboard, /* v */
+ (GtkTextFunction)gtk_editable_paste_clipboard, /* v */
(GtkTextFunction)gtk_text_delete_backward_word, /* w */
- gtk_editable_cut_clipboard, /* x */
+ (GtkTextFunction)gtk_editable_cut_clipboard, /* x */
NULL, /* y */
NULL, /* z */
};
editable_class->insert_text = gtk_text_insert_text;
editable_class->delete_text = gtk_text_delete_text;
+
+ editable_class->move_cursor = gtk_text_move_cursor;
+ editable_class->move_word = gtk_text_move_word;
+ editable_class->move_page = gtk_text_move_page;
+ editable_class->move_to_row = gtk_text_move_to_row;
+ editable_class->move_to_column = gtk_text_move_to_column;
+
+ editable_class->kill_char = gtk_text_kill_char;
+ editable_class->kill_word = gtk_text_kill_word;
+ editable_class->kill_line = gtk_text_kill_line;
+
editable_class->update_text = gtk_text_update_text;
editable_class->get_chars = gtk_text_get_chars;
editable_class->set_selection = gtk_text_set_selection;
if (event->state & GDK_SHIFT_MASK)
{
extend_selection = FALSE;
- gtk_editable_paste_clipboard (editable, event->time);
+ gtk_editable_paste_clipboard (editable);
}
else if (event->state & GDK_CONTROL_MASK)
{
- gtk_editable_copy_clipboard (editable, event->time);
+ gtk_editable_copy_clipboard (editable);
}
else
{
else if (event->state & GDK_SHIFT_MASK)
{
extend_selection = FALSE;
- gtk_editable_cut_clipboard (editable, event->time);
+ gtk_editable_cut_clipboard (editable);
}
else
gtk_text_delete_forward_character (text);
draw_cursor (text, FALSE);
}
+static void
+gtk_text_move_cursor (GtkEditable *editable,
+ gint x,
+ gint y)
+{
+ if (x > 0)
+ {
+ while (x-- != 0)
+ move_cursor_hor (GTK_TEXT (editable), 1);
+ }
+ else if (x < 0)
+ {
+ while (x++ != 0)
+ move_cursor_hor (GTK_TEXT (editable), -1);
+ }
+
+ if (y > 0)
+ {
+ while (y-- != 0)
+ move_cursor_ver (GTK_TEXT (editable), 1);
+ }
+ else if (x < 0)
+ {
+ while (y++ != 0)
+ move_cursor_ver (GTK_TEXT (editable), -1);
+ }
+}
+
static void
gtk_text_move_forward_character (GtkText *text)
{
move_cursor_ver (text, -1);
}
+static void
+gtk_text_move_word (GtkEditable *editable,
+ gint n)
+{
+ if (n > 0)
+ {
+ while (n-- != 0)
+ gtk_text_move_forward_word (GTK_TEXT (editable));
+ }
+ else if (n < 0)
+ {
+ while (n++ != 0)
+ gtk_text_move_backward_word (GTK_TEXT (editable));
+ }
+}
+
static void
gtk_text_move_forward_word (GtkText *text)
{
draw_cursor (text, FALSE);
}
-static void
-gtk_text_move_beginning_of_line (GtkText *text)
+static void
+gtk_text_move_page (GtkEditable *editable,
+ gint x,
+ gint y)
{
- text->cursor_virtual_x = 0;
+ if (y != 0)
+ scroll_int (GTK_TEXT (editable),
+ y * GTK_TEXT(editable)->vadj->page_increment);
+}
+
+static void
+gtk_text_move_to_row (GtkEditable *editable,
+ gint row)
+{
+}
+
+static void
+gtk_text_move_to_column (GtkEditable *editable,
+ gint column)
+{
+ GtkText *text;
+
+ text = GTK_TEXT (editable);
+
+ text->cursor_virtual_x = 0; /* FIXME */
undraw_cursor (text, FALSE);
-
+
+ /* Move to the beginning of the line */
while ((text->cursor_mark.index > 0) &&
(GTK_TEXT_INDEX (text, text->cursor_mark.index - 1) != LINE_DELIM))
decrement_mark (&text->cursor_mark);
-
+
+ while (!LAST_INDEX (text, text->cursor_mark) &&
+ (GTK_TEXT_INDEX (text, text->cursor_mark.index) != LINE_DELIM))
+ {
+ if (column > 0)
+ column--;
+ else if (column == 0)
+ break;
+
+ advance_mark (&text->cursor_mark);
+ }
+
find_cursor (text, TRUE);
draw_cursor (text, FALSE);
}
static void
-gtk_text_move_end_of_line (GtkText *text)
+gtk_text_move_beginning_of_line (GtkText *text)
{
- text->cursor_virtual_x = 0;
+ gtk_text_move_to_column (GTK_EDITABLE (text), 0);
- undraw_cursor (text, FALSE);
-
- while (!LAST_INDEX (text, text->cursor_mark) &&
- (GTK_TEXT_INDEX (text, text->cursor_mark.index) != LINE_DELIM))
- advance_mark (&text->cursor_mark);
-
- find_cursor (text, TRUE);
- draw_cursor (text, FALSE);
}
static void
-gtk_text_delete_forward_character (GtkText *text)
+gtk_text_move_end_of_line (GtkText *text)
{
- GtkEditable *editable;
- editable = GTK_EDITABLE (text);
+ gtk_text_move_to_column (GTK_EDITABLE (text), -1);
+}
+
+static void
+gtk_text_kill_char (GtkEditable *editable,
+ gint direction)
+{
+ GtkText *text;
+ text = GTK_TEXT (editable);
+
if (editable->selection_start_pos != editable->selection_end_pos)
gtk_editable_delete_selection (editable);
else
{
- if (text->point.index + 1 <= TEXT_LENGTH (text))
- gtk_editable_delete_text (editable, text->point.index, text->point.index + 1);
+ if (direction >= 0)
+ {
+ if (text->point.index + 1 <= TEXT_LENGTH (text))
+ gtk_editable_delete_text (editable, text->point.index, text->point.index + 1);
+ }
+ else
+ {
+ if (text->point.index > 0)
+ gtk_editable_delete_text (editable, text->point.index - 1, text->point.index);
+ }
}
}
+static void
+gtk_text_delete_forward_character (GtkText *text)
+{
+ gtk_text_kill_char (GTK_EDITABLE (text), 1);
+}
+
static void
gtk_text_delete_backward_character (GtkText *text)
{
- GtkEditable *editable;
- editable = GTK_EDITABLE (text);
+ gtk_text_kill_char (GTK_EDITABLE (text), -1);
+}
+static void
+gtk_text_kill_word (GtkEditable *editable,
+ gint direction)
+{
if (editable->selection_start_pos != editable->selection_end_pos)
gtk_editable_delete_selection (editable);
else
{
- if (text->point.index > 0)
- gtk_editable_delete_text (editable, text->point.index - 1, text->point.index);
+ gint old_pos = editable->current_pos;
+ if (direction >= 0)
+ {
+ gtk_text_move_word (editable, 1);
+ gtk_editable_delete_text (editable, old_pos, editable->current_pos);
+ }
+ else
+ {
+ gtk_text_move_word (editable, -1);
+ gtk_editable_delete_text (editable, editable->current_pos, old_pos);
+ }
}
}
static void
gtk_text_delete_forward_word (GtkText *text)
{
- guint old_pos;
-
- GtkEditable *editable;
- editable = GTK_EDITABLE (text);
-
- if (editable->selection_start_pos != editable->selection_end_pos)
- gtk_editable_delete_selection (editable);
- else
- {
- old_pos = text->cursor_mark.index;
- gtk_text_move_forward_word (text);
- gtk_editable_delete_text (editable, old_pos, text->cursor_mark.index);
- }
+ gtk_text_kill_word (GTK_EDITABLE (text), 1);
}
static void
gtk_text_delete_backward_word (GtkText *text)
{
- gint old_pos;
-
- GtkEditable *editable;
- editable = GTK_EDITABLE (text);
+ gtk_text_kill_word (GTK_EDITABLE (text), -1);
+}
- if (editable->selection_start_pos != editable->selection_end_pos)
- gtk_editable_delete_selection (editable);
+static void
+gtk_text_kill_line (GtkEditable *editable,
+ gint direction)
+{
+ gint old_pos = editable->current_pos;
+ if (direction >= 0)
+ {
+ gtk_text_move_to_column (editable, -1);
+ gtk_editable_delete_text (editable, old_pos, editable->current_pos);
+ }
else
{
- old_pos = text->cursor_mark.index;
- gtk_text_move_backward_word (text);
- gtk_editable_delete_text (editable, text->cursor_mark.index, old_pos);
+ gtk_text_move_to_column (editable, 0);
+ gtk_editable_delete_text (editable, editable->current_pos, old_pos);
}
}
static void
gtk_text_delete_line (GtkText *text)
{
- gint start_pos;
- gint end_pos;
- GtkEditable *editable = GTK_EDITABLE (text);
-
- gtk_text_move_beginning_of_line (text);
- start_pos = text->cursor_mark.index;
-
- gtk_text_move_end_of_line (text);
- gtk_text_move_forward_character (text);
- end_pos = text->cursor_mark.index;
-
- gtk_editable_delete_text (editable, start_pos, end_pos);
+ gtk_text_move_to_column (GTK_EDITABLE (text), 0);
+ gtk_text_kill_line (GTK_EDITABLE (text), 1);
}
static void
gtk_text_delete_to_line_end (GtkText *text)
{
- gint start_pos;
- gint end_pos;
- GtkEditable *editable = GTK_EDITABLE (text);
-
- start_pos = text->cursor_mark.index;
-
- gtk_text_move_end_of_line (text);
-
- if (start_pos == text->cursor_mark.index)
- gtk_text_move_forward_character (text);
- end_pos = text->cursor_mark.index;
-
- gtk_editable_delete_text (editable, start_pos, end_pos);
+ gtk_text_kill_line (GTK_EDITABLE (text), 1);
}
static void
extern GtkType GTK_TYPE_POSITION_TYPE;
extern GtkType GTK_TYPE_PREVIEW_TYPE;
extern GtkType GTK_TYPE_RELIEF_STYLE;
+extern GtkType GTK_TYPE_RESIZE_MODE;
extern GtkType GTK_TYPE_SIGNAL_RUN_TYPE;
extern GtkType GTK_TYPE_SCROLL_TYPE;
extern GtkType GTK_TYPE_SELECTION_MODE;
extern GtkType GTK_TYPE_GDK_EVENT;
extern GtkType GTK_TYPE_GDK_COLOR;
-#define GTK_TYPE_NUM_BUILTINS (98)
+#define GTK_TYPE_NUM_BUILTINS (99)
{ GTK_RELIEF_NONE, "GTK_RELIEF_NONE", "none" },
{ 0, NULL, NULL }
};
+static GtkEnumValue _gtk_resize_mode_values[] = {
+ { GTK_RESIZE_PARENT, "GTK_RESIZE_PARENT", "parent" },
+ { GTK_RESIZE_QUEUE, "GTK_RESIZE_QUEUE", "queue" },
+ { GTK_RESIZE_IMMEDIATE, "GTK_RESIZE_IMMEDIATE", "immediate" },
+ { 0, NULL, NULL }
+};
static GtkEnumValue _gtk_signal_run_type_values[] = {
{ GTK_RUN_FIRST, "GTK_RUN_FIRST", "first" },
{ GTK_RUN_LAST, "GTK_RUN_LAST", "last" },
GTK_TYPE_ENUM, _gtk_preview_type_values },
{ "GtkReliefStyle", >K_TYPE_RELIEF_STYLE,
GTK_TYPE_ENUM, _gtk_relief_style_values },
+ { "GtkResizeMode", >K_TYPE_RESIZE_MODE,
+ GTK_TYPE_ENUM, _gtk_resize_mode_values },
{ "GtkSignalRunType", >K_TYPE_SIGNAL_RUN_TYPE,
GTK_TYPE_FLAGS, _gtk_signal_run_type_values },
{ "GtkScrollType", >K_TYPE_SCROLL_TYPE,
GtkType GTK_TYPE_POSITION_TYPE = 0;
GtkType GTK_TYPE_PREVIEW_TYPE = 0;
GtkType GTK_TYPE_RELIEF_STYLE = 0;
+GtkType GTK_TYPE_RESIZE_MODE = 0;
GtkType GTK_TYPE_SIGNAL_RUN_TYPE = 0;
GtkType GTK_TYPE_SCROLL_TYPE = 0;
GtkType GTK_TYPE_SELECTION_MODE = 0;
GtkRequisition *requisition);
static void gtk_viewport_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static gint gtk_viewport_need_resize (GtkContainer *container);
+static void gtk_viewport_check_resize (GtkContainer *container);
static void gtk_viewport_adjustment_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
widget_class->size_allocate = gtk_viewport_size_allocate;
container_class->add = gtk_viewport_add;
- container_class->need_resize = gtk_viewport_need_resize;
+ container_class->check_resize = gtk_viewport_check_resize;
}
static void
GTK_WIDGET_UNSET_FLAGS (viewport, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (viewport, GTK_BASIC);
+ gtk_container_set_resize_mode (GTK_CONTAINER (viewport), GTK_RESIZE_QUEUE);
+
viewport->shadow_type = GTK_SHADOW_IN;
viewport->view_window = NULL;
viewport->bin_window = NULL;
}
}
-static gint
-gtk_viewport_need_resize (GtkContainer *container)
+static void
+gtk_viewport_check_resize (GtkContainer *container)
{
GtkBin *bin;
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_VIEWPORT (container), FALSE);
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_VIEWPORT (container));
if (GTK_WIDGET_REALIZED (container))
{
gtk_widget_size_allocate (GTK_WIDGET (container),
&(GTK_WIDGET (container)->allocation));
}
-
- return FALSE;
}
static void
static GdkVisual* gtk_widget_peek_visual (void);
static GtkStyle* gtk_widget_peek_style (void);
+static GtkWidget* gtk_widget_get_resize_container (GtkWidget *widget);
static void gtk_widget_reparent_container_child (GtkWidget *widget,
gpointer client_data);
static void gtk_widget_propagate_state (GtkWidget *widget,
/* Remove the widget and all its children from toplevel->resize_widgets
*/
+
+ toplevel = gtk_widget_get_resize_container (widget);
+
/* Three ways to make this prettier:
* Write a g_slist_conditional_remove (GSList, gboolean (*)(gpointer))
* Change resize_widgets to a GList
* Just bite the bullet and use g_slist_remove
*/
+
tmp_list = GTK_CONTAINER (toplevel)->resize_widgets;
prev_list = NULL;
while (tmp_list)
static gint
gtk_widget_idle_sizer (void *data)
{
- GSList *slist;
- GSList *re_queue;
-
- re_queue = NULL;
- while (gtk_widget_resize_queue)
+ GSList *slist = gtk_widget_resize_queue;
+ GSList *node = slist;
+
+ gtk_widget_resize_queue = NULL;
+
+ while (node)
{
- GtkWidget *widget;
-
- slist = gtk_widget_resize_queue;
- gtk_widget_resize_queue = slist->next;
- widget = slist->data;
-
+ GtkWidget *widget = node->data;
+
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
-
- gtk_widget_ref (widget);
- if (gtk_container_need_resize (GTK_CONTAINER (widget)))
- {
- slist->next = re_queue;
- re_queue = slist;
- }
- else
- {
- g_slist_free_1 (slist);
- gtk_widget_unref (widget);
- }
- }
-
- for (slist = re_queue; slist; slist = slist->next)
- {
- GtkWidget *widget;
-
- widget = slist->data;
- if (GTK_OBJECT (widget)->ref_count > 1 &&
- !GTK_OBJECT_DESTROYED (widget))
- gtk_widget_queue_resize (widget);
- gtk_widget_unref (widget);
+ gtk_container_check_resize (GTK_CONTAINER (widget));
+
+ node = node->next;
}
- g_slist_free (re_queue);
-
+
+ g_slist_free (slist);
+
return FALSE;
}
+/* The guts here should probably be moved into gtkcontainer.c */
+
void
gtk_widget_queue_resize (GtkWidget *widget)
{
- GtkWidget *toplevel;
+ GtkWidget *resize_widget;
+ GtkContainer *container;
g_return_if_fail (widget != NULL);
if (GTK_OBJECT_DESTROYED (widget))
return;
-
- toplevel = gtk_widget_get_toplevel (widget);
- if (GTK_WIDGET_TOPLEVEL (toplevel))
+
+ resize_widget = gtk_widget_get_resize_container (widget);
+
+ if (resize_widget)
{
- if (GTK_WIDGET_VISIBLE (toplevel))
+ container = GTK_CONTAINER (resize_widget);
+
+ if (GTK_WIDGET_VISIBLE (container))
{
- if (!GTK_CONTAINER_RESIZE_PENDING (toplevel))
- {
- GTK_PRIVATE_SET_FLAG (toplevel, GTK_RESIZE_PENDING);
- if (gtk_widget_resize_queue == NULL)
- gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1,
- gtk_widget_idle_sizer,
- NULL);
- gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel);
- }
-
- if (!GTK_WIDGET_RESIZE_NEEDED (widget))
+ switch (container->resize_mode)
{
- GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
- GTK_CONTAINER (toplevel)->resize_widgets =
- g_slist_prepend (GTK_CONTAINER (toplevel)->resize_widgets, widget);
+ case GTK_RESIZE_QUEUE:
+ if (!GTK_CONTAINER_RESIZE_PENDING (container))
+ {
+ GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_PENDING);
+ if (gtk_widget_resize_queue == NULL)
+ gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1,
+ gtk_widget_idle_sizer,
+ NULL);
+ gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, container);
+ }
+
+ if (!GTK_WIDGET_RESIZE_NEEDED (widget))
+ {
+ GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
+ container->resize_widgets =
+ g_slist_prepend (container->resize_widgets, widget);
+ }
+ else
+ g_assert (g_slist_find (container->resize_widgets, widget)); /* paranoid */
+ break;
+
+ case GTK_RESIZE_IMMEDIATE:
+ container->resize_widgets =
+ g_slist_prepend (container->resize_widgets, widget);
+ gtk_container_check_resize (container);
+ case GTK_RESIZE_PARENT:
+ /* Ignore */
}
- else
- g_assert (g_slist_find (GTK_CONTAINER (toplevel)->resize_widgets, widget)); /* paranoid */
}
else
- gtk_container_need_resize (GTK_CONTAINER (toplevel));
+ {
+ /* We need to let hidden toplevels know that something
+ * changed while they where hidden. For other resize containers,
+ * they will get resized when they are shown.
+ */
+ if (GTK_WIDGET_TOPLEVEL (container))
+ gtk_container_check_resize (container);
+ }
}
}
}
+/*****************************************
+ * gtk_widget_get_resize_container:
+ *
+ * arguments:
+ *
+ * results:
+ *****************************************/
+
+static GtkWidget *
+gtk_widget_get_resize_container (GtkWidget *widget)
+{
+ g_return_val_if_fail (widget != NULL, NULL);
+
+ while (widget->parent)
+ {
+ widget = widget->parent;
+ if (GTK_CONTAINER (widget)->resize_mode != GTK_RESIZE_PARENT)
+ break;
+ }
+
+ return GTK_IS_CONTAINER (widget) ? widget : NULL;
+}
+
/*****************************************
* gtk_widget_get_toplevel:
*
#include "gtkbindings.h"
enum {
- MOVE_RESIZE,
SET_FOCUS,
LAST_SIGNAL
};
gpointer arg1,
gpointer data);
-static void gtk_window_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
static void gtk_window_marshal_signal_2 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GdkEventFocus *event);
static gint gtk_window_client_event (GtkWidget *widget,
GdkEventClient *event);
-static gint gtk_window_need_resize (GtkContainer *container);
-static gint gtk_real_window_move_resize (GtkWindow *window,
- gint *x,
- gint *y,
- gint width,
- gint height);
+static void gtk_window_check_resize (GtkContainer *container);
static void gtk_real_window_set_focus (GtkWindow *window,
GtkWidget *focus);
-static gint gtk_window_move_resize (GtkWidget *widget);
+static void gtk_window_move_resize (GtkWindow *window);
static void gtk_window_set_hints (GtkWidget *widget,
GtkRequisition *requisition);
gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_GROW);
gtk_object_add_arg_type ("GtkWindow::window_position", GTK_TYPE_WINDOW_POSITION, GTK_ARG_READWRITE, ARG_WIN_POS);
- window_signals[MOVE_RESIZE] =
- gtk_signal_new ("move_resize",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWindowClass, move_resize),
- gtk_window_marshal_signal_1,
- GTK_TYPE_BOOL, 4,
- GTK_TYPE_POINTER, GTK_TYPE_POINTER,
- GTK_TYPE_INT, GTK_TYPE_INT);
-
window_signals[SET_FOCUS] =
gtk_signal_new ("set_focus",
GTK_RUN_LAST,
widget_class->focus_out_event = gtk_window_focus_out_event;
widget_class->client_event = gtk_window_client_event;
- container_class->need_resize = gtk_window_need_resize;
+ container_class->check_resize = gtk_window_check_resize;
- klass->move_resize = gtk_real_window_move_resize;
klass->set_focus = gtk_real_window_set_focus;
}
window->focus_widget = NULL;
window->default_widget = NULL;
window->resize_count = 0;
- window->need_resize = FALSE;
window->allow_shrink = FALSE;
window->allow_grow = TRUE;
window->auto_shrink = FALSE;
window->position = GTK_WIN_POS_NONE;
window->use_uposition = TRUE;
+ gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE);
gtk_container_register_toplevel (GTK_CONTAINER (window));
}
return FALSE;
}
-static void
-gtk_window_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWindowSignal1 rfunc;
- gint *return_val;
-
- rfunc = (GtkWindowSignal1) func;
- return_val = GTK_RETLOC_BOOL (args[4]);
-
- *return_val = (* rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_INT (args[3]),
- func_data);
-}
-
static void
gtk_window_marshal_signal_2 (GtkObject *object,
GtkSignalFunc func,
g_return_if_fail (GTK_IS_WINDOW (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
- gtk_container_need_resize (GTK_CONTAINER (widget));
+ gtk_container_check_resize (GTK_CONTAINER (widget));
gtk_widget_map (widget);
}
else
{
if (!GTK_WIDGET_VISIBLE (window))
- window->need_resize = TRUE;
+ GTK_CONTAINER (window)->need_resize = TRUE;
}
}
return FALSE;
}
-static gint
-gtk_window_need_resize (GtkContainer *container)
+static void
+gtk_window_check_resize (GtkContainer *container)
{
GtkWindow *window;
- gint return_val;
-
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (container), FALSE);
- return_val = FALSE;
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_WINDOW (container));
window = GTK_WINDOW (container);
- if (window->handling_resize)
- return return_val;
-
- if (GTK_WIDGET_VISIBLE (container))
- return_val = gtk_window_move_resize (GTK_WIDGET (window));
- else
- window->need_resize = TRUE;
-
- return return_val;
+ if (!window->handling_resize)
+ {
+ if (GTK_WIDGET_VISIBLE (container))
+ gtk_window_move_resize (window);
+ else
+ GTK_CONTAINER (window)->need_resize = TRUE;
+ }
}
-static gint
-gtk_real_window_move_resize (GtkWindow *window,
- gint *x,
- gint *y,
- gint width,
- gint height)
+/* FIXME: we leave container->resize_widgets set under some
+ circumstances ? */
+static void
+gtk_window_move_resize (GtkWindow *window)
{
- GtkWidget *widget;
+ GtkWidget *widget;
+ GtkContainer *container;
+ gint x, y;
+ gint width, height;
+ gint screen_width;
+ gint screen_height;
gboolean needed_resize;
-
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
- g_return_val_if_fail ((x != NULL) || (y != NULL), FALSE);
+
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GTK_IS_WINDOW (window));
widget = GTK_WIDGET (window);
+ container = GTK_CONTAINER (widget);
+
+ /* Remember old size, to know if we have to reset hints */
+ width = widget->requisition.width;
+ height = widget->requisition.height;
+ gtk_widget_size_request (widget, &widget->requisition);
+
+ if ((width != widget->requisition.width ||
+ height != widget->requisition.height))
+ gtk_window_set_hints (widget, &widget->requisition);
+
+ x = -1;
+ y = -1;
+ width = widget->requisition.width;
+ height = widget->requisition.height;
+
+ if (window->use_uposition)
+ switch (window->position)
+ {
+ case GTK_WIN_POS_CENTER:
+ x = (gdk_screen_width () - width) / 2;
+ y = (gdk_screen_height () - height) / 2;
+ gtk_widget_set_uposition (widget, x, y);
+ break;
+ case GTK_WIN_POS_MOUSE:
+ gdk_window_get_pointer (NULL, &x, &y, NULL);
+
+ x -= width / 2;
+ y -= height / 2;
+
+ screen_width = gdk_screen_width ();
+ screen_height = gdk_screen_height ();
+
+ if (x < 0)
+ x = 0;
+ else if (x > (screen_width - width))
+ x = screen_width - width;
+
+ if (y < 0)
+ y = 0;
+ else if (y > (screen_height - height))
+ y = screen_height - height;
+
+ gtk_widget_set_uposition (widget, x, y);
+ break;
+ }
- needed_resize = window->need_resize;
- window->need_resize = FALSE;
+ /* Now, do the resizing */
+
+ needed_resize = container->need_resize;
+ container->need_resize = FALSE;
if ((widget->requisition.width == 0) ||
(widget->requisition.height == 0))
gtk_widget_size_allocate (widget, &allocation);
- return FALSE;
+ return;
}
gdk_window_get_geometry (widget->window, NULL, NULL, &width, &height, NULL);
(height < widget->requisition.height))
{
window->resize_count += 1;
- if ((*x != -1) && (*y != -1))
- gdk_window_move_resize (widget->window, *x, *y,
+ if ((x != -1) && (y != -1))
+ gdk_window_move_resize (widget->window, x, y,
widget->requisition.width,
widget->requisition.height);
else
allocation.height = widget->requisition.height;
gtk_widget_size_allocate (widget, &allocation);
+ gtk_container_clear_resize_widgets (GTK_CONTAINER (window));
}
else
{
- /* The window hasn't changed size but one of its children
- * queued a resize request. Which means that the allocation
- * is not sufficient for the requisition of some child.
- * We've already performed a size request at this point,
- * so we simply need to run through the list of resize
- * widgets and reallocate their sizes appropriately. We
- * make the optimization of not performing reallocation
- * for a widget who also has a parent in the resize widgets
- * list. GTK_RESIZE_NEEDED is used for flagging those
- * parents inside this function.
- */
- GSList *resize_widgets;
- GSList *resize_containers;
- GSList *node;
-
- if ((*x != -1) && (*y != -1))
- gdk_window_move (widget->window, *x, *y);
+ if ((x != -1) && (y != -1))
+ gdk_window_move (widget->window, x, y);
- resize_widgets = GTK_CONTAINER (window)->resize_widgets;
- GTK_CONTAINER (window)->resize_widgets = NULL;
-
- for (node = resize_widgets; node; node = node->next)
- {
- widget = node->data;
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
-
- while (widget && widget->parent &&
- ((widget->allocation.width < widget->requisition.width) ||
- (widget->allocation.height < widget->requisition.height)))
- widget = widget->parent;
-
- GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
- node->data = widget;
- }
-
- resize_containers = NULL;
-
- for (node = resize_widgets; node; node = node->next)
- {
- GtkWidget *resize_container;
-
- widget = node->data;
-
- if (!GTK_WIDGET_RESIZE_NEEDED (widget))
- continue;
-
- resize_container = widget->parent;
-
- if (resize_container)
- {
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
- widget = resize_container->parent;
-
- while (widget)
- {
- if (GTK_WIDGET_RESIZE_NEEDED (widget))
- {
- GTK_PRIVATE_UNSET_FLAG (resize_container, GTK_RESIZE_NEEDED);
- resize_container = widget;
- }
- widget = widget->parent;
- }
- }
- else
- resize_container = widget;
-
- if (!g_slist_find (resize_containers, resize_container))
- resize_containers = g_slist_prepend (resize_containers,
- resize_container);
- }
- g_slist_free (resize_widgets);
-
- for (node = resize_containers; node; node = node->next)
- {
- widget = node->data;
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
- gtk_widget_size_allocate (widget, &widget->allocation);
- gtk_widget_queue_draw (widget);
- }
- g_slist_free (resize_containers);
+ gtk_container_resize_children (GTK_CONTAINER (window));
}
-
- return FALSE;
-}
-
-static gint
-gtk_window_move_resize (GtkWidget *widget)
-{
- GtkWindow *window;
- gint x, y;
- gint width, height;
- gint screen_width;
- gint screen_height;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
-
- window = GTK_WINDOW (widget);
- return_val = FALSE;
-
- /* Remember old size, to know if we have to reset hints */
- width = widget->requisition.width;
- height = widget->requisition.height;
- gtk_widget_size_request (widget, &widget->requisition);
-
- if ((width != widget->requisition.width ||
- height != widget->requisition.height))
- gtk_window_set_hints (widget, &widget->requisition);
-
- x = -1;
- y = -1;
- width = widget->requisition.width;
- height = widget->requisition.height;
-
- if (window->use_uposition)
- switch (window->position)
- {
- case GTK_WIN_POS_CENTER:
- x = (gdk_screen_width () - width) / 2;
- y = (gdk_screen_height () - height) / 2;
- gtk_widget_set_uposition (widget, x, y);
- break;
- case GTK_WIN_POS_MOUSE:
- gdk_window_get_pointer (NULL, &x, &y, NULL);
-
- x -= width / 2;
- y -= height / 2;
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- if (x < 0)
- x = 0;
- else if (x > (screen_width - width))
- x = screen_width - width;
-
- if (y < 0)
- y = 0;
- else if (y > (screen_height - height))
- y = screen_height - height;
-
- gtk_widget_set_uposition (widget, x, y);
- break;
- }
-
- gtk_signal_emit (GTK_OBJECT (widget), window_signals[MOVE_RESIZE],
- &x, &y, width, height, &return_val);
-
- return return_val;
}
static void
GtkWidget *default_widget;
gushort resize_count;
- guint need_resize : 1;
guint allow_shrink : 1;
guint allow_grow : 1;
guint auto_shrink : 1;
{
GtkBinClass parent_class;
- gint (* move_resize) (GtkWindow *window,
- gint *x,
- gint *y,
- gint width,
- gint height);
void (* set_focus) (GtkWindow *window,
GtkWidget *focus);
};
}
void
-font_selection_ok (GtkWidget *w,
- GtkFontSelection *fs)
+font_selection_ok (GtkWidget *w,
+ GtkFontSelectionDialog *fs)
{
- g_print ("%s\n", gtk_font_selection_get_font_name (fs));
+ g_print ("%s\n", gtk_font_selection_dialog_get_font_name (fs));
gtk_widget_destroy (GTK_WIDGET (fs));
}
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
"clicked", GTK_SIGNAL_FUNC(font_selection_ok),
- GTK_FONT_SELECTION_DIALOG (window)->fontsel);
+ GTK_FONT_SELECTION_DIALOG (window));
gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT (window));
#include <stdio.h>
#include <gtk/gtk.h>
#include "../config.h"
-#include <pthread.h>
#ifdef USE_PTHREADS
+#include <pthread.h>
+
static int nthreads = 0;
static pthread_mutex_t nthreads_mutex = PTHREAD_MUTEX_INITIALIZER;
}
void
-font_selection_ok (GtkWidget *w,
- GtkFontSelection *fs)
+font_selection_ok (GtkWidget *w,
+ GtkFontSelectionDialog *fs)
{
- g_print ("%s\n", gtk_font_selection_get_font_name (fs));
+ g_print ("%s\n", gtk_font_selection_dialog_get_font_name (fs));
gtk_widget_destroy (GTK_WIDGET (fs));
}
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
"clicked", GTK_SIGNAL_FUNC(font_selection_ok),
- GTK_FONT_SELECTION_DIALOG (window)->fontsel);
+ GTK_FONT_SELECTION_DIALOG (window));
gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT (window));
#include <stdio.h>
#include <gtk/gtk.h>
#include "../config.h"
-#include <pthread.h>
#ifdef USE_PTHREADS
+#include <pthread.h>
+
static int nthreads = 0;
static pthread_mutex_t nthreads_mutex = PTHREAD_MUTEX_INITIALIZER;